
package com.yjy.orderStateTest;

public class Context {
    private OrderState orderState;

    public Context(OrderState orderState) {
        this.orderState = orderState;
    }

    public void setOrderState(OrderState orderState) {
        this.orderState = orderState;
    }

    public void action() {
        this.orderState.action(this);
    }

    public void printInfo() {
        if (this.orderState != null) {
            this.orderState.doPrint();
        }
    }
}